# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -O0 -march=aarch64 -run-pass=legalizer -global-isel-abort=1 %s -o - | FileCheck %s
# RUN: llc -O0 -debugify-and-strip-all-safe -march=aarch64 -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK
---
name:            test_shift
body:             |
  bb.0.entry:
    ; CHECK-LABEL: name: test_shift
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC]], [[C]]
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
    ; CHECK: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC1]], 8
    ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SEXT_INREG]], [[AND]](s32)
    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ASHR]](s32)
    ; CHECK: $w0 = COPY [[COPY2]](s32)
    ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC2]], [[C]]
    ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
    ; CHECK: [[AND2:%[0-9]+]]:_(s32) = G_AND [[TRUNC3]], [[C]]
    ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[AND2]], [[AND1]](s32)
    ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
    ; CHECK: $w0 = COPY [[COPY3]](s32)
    ; CHECK: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
    ; CHECK: [[AND3:%[0-9]+]]:_(s32) = G_AND [[TRUNC4]], [[C]]
    ; CHECK: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
    ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC5]], [[AND3]](s32)
    ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SHL]](s32)
    ; CHECK: $w0 = COPY [[COPY4]](s32)
    %0:_(s64) = COPY $x0
    %1:_(s64) = COPY $x1
    %2:_(s8) = G_TRUNC %0(s64)
    %3:_(s8) = G_TRUNC %1(s64)
    %4:_(s8) = G_ASHR %2, %3
    %7:_(s32) = G_ANYEXT %4(s8)
    $w0 = COPY %7(s32)
    %5:_(s8) = G_LSHR %2, %3
    %8:_(s32) = G_ANYEXT %5(s8)
    $w0 = COPY %8(s32)
    %6:_(s8) = G_SHL %2, %3
    %9:_(s32) = G_ANYEXT %6(s8)
    $w0 = COPY %9(s32)

...
---
name: test_shl_i64_i32
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_shl_i64_i32
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
    ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[ZEXT]](s64)
    ; CHECK: $x0 = COPY [[SHL]](s64)
    %0:_(s64) = COPY $x0
    %1:_(s32) = COPY $w1
    %2:_(s64) = G_SHL %0, %1
    $x0 = COPY %2(s64)

...
---
name: test_ashr_i64_i32
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_ashr_i64_i32
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
    ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[COPY]], [[ZEXT]](s64)
    ; CHECK: $x0 = COPY [[ASHR]](s64)
    %0:_(s64) = COPY $x0
    %1:_(s32) = COPY $w1
    %2:_(s64) = G_ASHR %0, %1
    $x0 = COPY %2(s64)

...
---
name: test_lshr_i64_i32
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_lshr_i64_i32
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
    ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[COPY]], [[ZEXT]](s64)
    ; CHECK: $x0 = COPY [[LSHR]](s64)
    %0:_(s64) = COPY $x0
    %1:_(s32) = COPY $w1
    %2:_(s64) = G_LSHR %0, %1
    $x0 = COPY %2(s64)

...

---
name: test_shl_s128_s128
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_shl_s128_s128
    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s128) = COPY $q1
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
    ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](s128)
    ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[TRUNC]], [[C]]
    ; CHECK: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C]], [[TRUNC]]
    ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
    ; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s64), [[C]]
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP]](s32)
    ; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s64), [[C1]]
    ; CHECK: [[TRUNC2:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP1]](s32)
    ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV]], [[TRUNC]](s64)
    ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[SUB1]](s64)
    ; CHECK: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[TRUNC]](s64)
    ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL1]]
    ; CHECK: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[UV]], [[SUB]](s64)
    ; CHECK: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[SHL]], [[C1]]
    ; CHECK: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[OR]], [[SHL2]]
    ; CHECK: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC2]](s1), [[UV1]], [[SELECT1]]
    ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[SELECT]](s64), [[SELECT2]](s64)
    ; CHECK: $q0 = COPY [[MV]](s128)
    %0:_(s128) = COPY $q0
    %1:_(s128) = COPY $q1
    %2:_(s128) = G_SHL %0, %1
    $q0 = COPY %2

...

---
name: test_lshr_s128_s128
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_lshr_s128_s128
    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s128) = COPY $q1
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
    ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](s128)
    ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[TRUNC]], [[C]]
    ; CHECK: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C]], [[TRUNC]]
    ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
    ; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s64), [[C]]
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP]](s32)
    ; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s64), [[C1]]
    ; CHECK: [[TRUNC2:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP1]](s32)
    ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[UV1]], [[TRUNC]](s64)
    ; CHECK: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[TRUNC]](s64)
    ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[SUB1]](s64)
    ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR1]], [[SHL]]
    ; CHECK: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR [[UV1]], [[SUB]](s64)
    ; CHECK: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[OR]], [[LSHR2]]
    ; CHECK: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC2]](s1), [[UV]], [[SELECT]]
    ; CHECK: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[LSHR]], [[C1]]
    ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[SELECT1]](s64), [[SELECT2]](s64)
    ; CHECK: $q0 = COPY [[MV]](s128)
    %0:_(s128) = COPY $q0
    %1:_(s128) = COPY $q1
    %2:_(s128) = G_LSHR %0, %1
    $q0 = COPY %2

...

---
name: test_ashr_s128_s128
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_ashr_s128_s128
    ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(s128) = COPY $q1
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
    ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](s128)
    ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[TRUNC]], [[C]]
    ; CHECK: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C]], [[TRUNC]]
    ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
    ; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s64), [[C]]
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP]](s32)
    ; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s64), [[C1]]
    ; CHECK: [[TRUNC2:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP1]](s32)
    ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[UV1]], [[TRUNC]](s64)
    ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[TRUNC]](s64)
    ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[SUB1]](s64)
    ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL]]
    ; CHECK: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
    ; CHECK: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[UV1]], [[C2]](s64)
    ; CHECK: [[ASHR2:%[0-9]+]]:_(s64) = G_ASHR [[UV1]], [[SUB]](s64)
    ; CHECK: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[OR]], [[ASHR2]]
    ; CHECK: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC2]](s1), [[UV]], [[SELECT]]
    ; CHECK: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[ASHR]], [[ASHR1]]
    ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[SELECT1]](s64), [[SELECT2]](s64)
    ; CHECK: $q0 = COPY [[MV]](s128)
    %0:_(s128) = COPY $q0
    %1:_(s128) = COPY $q1
    %2:_(s128) = G_ASHR %0, %1
    $q0 = COPY %2

...

---
name: test_ashr_v2i32
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_ashr_v2i32
    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
    ; CHECK: [[ASHR:%[0-9]+]]:_(<2 x s32>) = G_ASHR [[COPY]], [[COPY1]](<2 x s32>)
    ; CHECK: $d0 = COPY [[ASHR]](<2 x s32>)
    %0:_(<2 x s32>) = COPY $d0
    %1:_(<2 x s32>) = COPY $d1
    %2:_(<2 x s32>) = G_ASHR %0, %1
    $d0 = COPY %2

...
---
name: test_ashr_v4i32
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_ashr_v4i32
    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
    ; CHECK: [[ASHR:%[0-9]+]]:_(<4 x s32>) = G_ASHR [[COPY]], [[COPY1]](<4 x s32>)
    ; CHECK: $q0 = COPY [[ASHR]](<4 x s32>)
    %0:_(<4 x s32>) = COPY $q0
    %1:_(<4 x s32>) = COPY $q1
    %2:_(<4 x s32>) = G_ASHR %0, %1
    $q0 = COPY %2

...
---
name:            shl_cimm_32
body:             |
  bb.1:
    liveins: $w0

    ; CHECK-LABEL: name: shl_cimm_32
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
    ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s64)
    ; CHECK: $w0 = COPY [[SHL]](s32)
    ; CHECK: RET_ReallyLR implicit $w0
    %0:_(s32) = COPY $w0
    %1:_(s32) = G_CONSTANT i32 8
    %2:_(s32) = G_SHL %0, %1(s32)
    $w0 = COPY %2(s32)
    RET_ReallyLR implicit $w0

...
---
name:            lshr_cimm_32
body:             |
  bb.1:
    liveins: $w0

    ; CHECK-LABEL: name: lshr_cimm_32
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
    ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY]], [[C]](s64)
    ; CHECK: $w0 = COPY [[LSHR]](s32)
    ; CHECK: RET_ReallyLR implicit $w0
    %0:_(s32) = COPY $w0
    %1:_(s32) = G_CONSTANT i32 8
    %2:_(s32) = G_LSHR %0, %1(s32)
    $w0 = COPY %2(s32)
    RET_ReallyLR implicit $w0

...
---
name:            ashr_cimm_32
body:             |
  bb.1:
    liveins: $w0

    ; CHECK-LABEL: name: ashr_cimm_32
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
    ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], [[C]](s64)
    ; CHECK: $w0 = COPY [[ASHR]](s32)
    ; CHECK: RET_ReallyLR implicit $w0
    %0:_(s32) = COPY $w0
    %1:_(s32) = G_CONSTANT i32 8
    %2:_(s32) = G_ASHR %0, %1(s32)
    $w0 = COPY %2(s32)
    RET_ReallyLR implicit $w0

...
---
name: test_ashr_v16i8
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_ashr_v16i8
    ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
    ; CHECK: [[ASHR:%[0-9]+]]:_(<16 x s8>) = G_ASHR [[COPY]], [[COPY1]](<16 x s8>)
    ; CHECK: $q0 = COPY [[ASHR]](<16 x s8>)
    %0:_(<16 x s8>) = COPY $q0
    %1:_(<16 x s8>) = COPY $q1
    %2:_(<16 x s8>) = G_ASHR %0, %1
    $q0 = COPY %2
...
---
name: test_ashr_v8i16
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_ashr_v8i16
    ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
    ; CHECK: [[ASHR:%[0-9]+]]:_(<8 x s16>) = G_ASHR [[COPY]], [[COPY1]](<8 x s16>)
    ; CHECK: $q0 = COPY [[ASHR]](<8 x s16>)
    %0:_(<8 x s16>) = COPY $q0
    %1:_(<8 x s16>) = COPY $q1
    %2:_(<8 x s16>) = G_ASHR %0, %1
    $q0 = COPY %2
...
---
name: test_shl_v16i8
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_shl_v16i8
    ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
    ; CHECK: [[SHL:%[0-9]+]]:_(<16 x s8>) = G_SHL [[COPY]], [[COPY1]](<16 x s8>)
    ; CHECK: $q0 = COPY [[SHL]](<16 x s8>)
    %0:_(<16 x s8>) = COPY $q0
    %1:_(<16 x s8>) = COPY $q1
    %2:_(<16 x s8>) = G_SHL %0, %1
    $q0 = COPY %2
...
---
name: test_shl_v8i16
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_shl_v8i16
    ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
    ; CHECK: [[SHL:%[0-9]+]]:_(<8 x s16>) = G_SHL [[COPY]], [[COPY1]](<8 x s16>)
    ; CHECK: $q0 = COPY [[SHL]](<8 x s16>)
    %0:_(<8 x s16>) = COPY $q0
    %1:_(<8 x s16>) = COPY $q1
    %2:_(<8 x s16>) = G_SHL %0, %1
    $q0 = COPY %2
...
---
name: test_lshr_v16i8
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_lshr_v16i8
    ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
    ; CHECK: [[LSHR:%[0-9]+]]:_(<16 x s8>) = G_LSHR [[COPY]], [[COPY1]](<16 x s8>)
    ; CHECK: $q0 = COPY [[LSHR]](<16 x s8>)
    %0:_(<16 x s8>) = COPY $q0
    %1:_(<16 x s8>) = COPY $q1
    %2:_(<16 x s8>) = G_LSHR %0, %1
    $q0 = COPY %2
...
---
name: test_lshr_v8i16
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_lshr_v8i16
    ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
    ; CHECK: [[LSHR:%[0-9]+]]:_(<8 x s16>) = G_LSHR [[COPY]], [[COPY1]](<8 x s16>)
    ; CHECK: $q0 = COPY [[LSHR]](<8 x s16>)
    %0:_(<8 x s16>) = COPY $q0
    %1:_(<8 x s16>) = COPY $q1
    %2:_(<8 x s16>) = G_LSHR %0, %1
    $q0 = COPY %2
...
---
name: test_shl_v4i16
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_shl_v4i16
    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
    ; CHECK: [[SHL:%[0-9]+]]:_(<4 x s16>) = G_SHL [[COPY]], [[COPY1]](<4 x s16>)
    ; CHECK: $d0 = COPY [[SHL]](<4 x s16>)
    %0:_(<4 x s16>) = COPY $d0
    %1:_(<4 x s16>) = COPY $d1
    %2:_(<4 x s16>) = G_SHL %0, %1
    $d0 = COPY %2
...
---
name: test_lshr_v4i16
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_lshr_v4i16
    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
    ; CHECK: [[LSHR:%[0-9]+]]:_(<4 x s16>) = G_LSHR [[COPY]], [[COPY1]](<4 x s16>)
    ; CHECK: $d0 = COPY [[LSHR]](<4 x s16>)
    %0:_(<4 x s16>) = COPY $d0
    %1:_(<4 x s16>) = COPY $d1
    %2:_(<4 x s16>) = G_LSHR %0, %1
    $d0 = COPY %2
...
---
name: test_ashr_v4i16
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_ashr_v4i16
    ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
    ; CHECK: [[ASHR:%[0-9]+]]:_(<4 x s16>) = G_ASHR [[COPY]], [[COPY1]](<4 x s16>)
    ; CHECK: $d0 = COPY [[ASHR]](<4 x s16>)
    %0:_(<4 x s16>) = COPY $d0
    %1:_(<4 x s16>) = COPY $d1
    %2:_(<4 x s16>) = G_ASHR %0, %1
    $d0 = COPY %2
...
---
name: test_ashr_v8s32
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_ashr_v8s32
    ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[DEF]](s32), [[DEF]](s32), [[DEF]](s32), [[DEF]](s32)
    ; CHECK: [[BUILD_VECTOR1:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[DEF]](s32), [[DEF]](s32), [[DEF]](s32), [[DEF]](s32)
    ; CHECK: [[BUILD_VECTOR2:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[DEF]](s32), [[DEF]](s32), [[DEF]](s32), [[DEF]](s32)
    ; CHECK: [[BUILD_VECTOR3:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[DEF]](s32), [[DEF]](s32), [[DEF]](s32), [[DEF]](s32)
    ; CHECK: [[ASHR:%[0-9]+]]:_(<4 x s32>) = G_ASHR [[BUILD_VECTOR]], [[BUILD_VECTOR2]](<4 x s32>)
    ; CHECK: [[ASHR1:%[0-9]+]]:_(<4 x s32>) = G_ASHR [[BUILD_VECTOR1]], [[BUILD_VECTOR3]](<4 x s32>)
    ; CHECK: $q0 = COPY [[ASHR]](<4 x s32>)
    ; CHECK: $q1 = COPY [[ASHR1]](<4 x s32>)
    %0:_(<8 x s32>) = G_IMPLICIT_DEF
    %1:_(<8 x s32>) = G_IMPLICIT_DEF
    %2:_(<8 x s32>) = G_ASHR %0, %1
    %3:_(<4 x s32>), %4:_(<4 x s32>) = G_UNMERGE_VALUES %2
    $q0 = COPY %3(<4 x s32>)
    $q1 = COPY %4(<4 x s32>)
...
---
name: test_shl_v8s8
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_shl_v8s8
    ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
    ; CHECK: [[SHL:%[0-9]+]]:_(<8 x s8>) = G_SHL [[COPY]], [[COPY1]](<8 x s8>)
    ; CHECK: $d0 = COPY [[SHL]](<8 x s8>)
    %0:_(<8 x s8>) = COPY $d0
    %1:_(<8 x s8>) = COPY $d1
    %2:_(<8 x s8>) = G_SHL %0, %1
    $d0 = COPY %2
...
---
name: test_ashr_v8s8
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_ashr_v8s8
    ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
    ; CHECK: [[ASHR:%[0-9]+]]:_(<8 x s8>) = G_ASHR [[COPY]], [[COPY1]](<8 x s8>)
    ; CHECK: $d0 = COPY [[ASHR]](<8 x s8>)
    %0:_(<8 x s8>) = COPY $d0
    %1:_(<8 x s8>) = COPY $d1
    %2:_(<8 x s8>) = G_ASHR %0, %1
    $d0 = COPY %2
...

---
name: test_lshr_v8s8
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_lshr_v8s8
    ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
    ; CHECK: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
    ; CHECK: [[LSHR:%[0-9]+]]:_(<8 x s8>) = G_LSHR [[COPY]], [[COPY1]](<8 x s8>)
    ; CHECK: $d0 = COPY [[LSHR]](<8 x s8>)
    %0:_(<8 x s8>) = COPY $d0
    %1:_(<8 x s8>) = COPY $d1
    %2:_(<8 x s8>) = G_LSHR %0, %1
    $d0 = COPY %2
...
---
name: test_lshr_nonpow2
body:             |
  bb.0:
    ; CHECK-LABEL: name: test_lshr_nonpow2
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
    ; CHECK: %a:_(s32) = COPY $w1
    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
    ; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES %a(s32), %a(s32)
    ; CHECK: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES %a(s32), [[C]](s32)
    ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
    ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[C1]]
    ; CHECK: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C1]], [[COPY]]
    ; CHECK: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
    ; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s64), [[C1]]
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP]](s32)
    ; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY]](s64), [[C2]]
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP1]](s32)
    ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[MV1]], [[COPY]](s64)
    ; CHECK: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[MV]], [[COPY]](s64)
    ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[MV1]], [[SUB1]](s64)
    ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR1]], [[SHL]]
    ; CHECK: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR [[MV1]], [[SUB]](s64)
    ; CHECK: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[OR]], [[LSHR2]]
    ; CHECK: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[MV]], [[SELECT]]
    ; CHECK: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC]](s1), [[LSHR]], [[C2]]
    ; CHECK: %d1:_(s32), %d2:_(s32) = G_UNMERGE_VALUES [[SELECT1]](s64)
    ; CHECK: $w0 = COPY %d2(s32)
    %0:_(s64) = COPY $x0
    %a:_(s32) = COPY $w1
    %merge:_(s96) = G_MERGE_VALUES %a, %a, %a
    %lshr:_(s96) = G_LSHR %merge, %0
    %d1:_(s32), %d2:_(s32), %d3:_(s32) = G_UNMERGE_VALUES %lshr
    $w0 = COPY %d2(s32)

...
